//
//  LaomiRequestModel.h
//  LaomiKit
//
//  Created by laomi on 2020/7/16.
//  Copyright © 2020 laomi. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^LaomiCommonBlock)(id _Nullable obj);
extern NSString * _Nullable const CPUserInfoStoreKey;


extern NSInteger const request_login_expire; // 默认  401;//登录过期；可以自己修改
extern NSString * _Nullable const request_status_key; // 默认@"status";//http请求keystatus
extern NSString * _Nullable const request_data_key;// 默认 = @"result";//http 请求数据字
extern NSInteger const http_success_code ;// 默认= 200;
extern NSInteger const http_server_error_code ;// 默认 = 500;
extern NSString * _Nullable const request_login_expire_notification; // 登录超时通知

NS_ASSUME_NONNULL_BEGIN

@interface LaomiRequestModel : NSObject
@property(nonatomic,assign)BOOL isNeedLoading;

//loading的时候提示语
@property(nonatomic,copy)NSString *loadingString;
//net work error 提示语
@property(nonatomic,copy)NSString *networkErrorString;
//url
@property(nonatomic,copy)NSString *url;
//参数
@property(nonatomic,strong)NSDictionary *param;
// M方法
@property(nonatomic,copy)NSString *method;
//头部
@property(nonatomic,strong)NSDictionary *header;



//成功回调
@property(nonatomic,copy)LaomiCommonBlock sucess;
@property(nonatomic,assign)NSInteger SUCCESS_CODE;//成功的code
@property(nonatomic,copy)NSString *request_data_key;//结果集的key
@property(nonatomic,copy)NSString *request_status_key;//状态值的key

//失败回调
@property(nonatomic,copy)LaomiCommonBlock failed;


//过期
@property(nonatomic,copy)LaomiCommonBlock expireBlock;
@property(nonatomic,assign)NSInteger EXPIRE_CODE;//过期的code











// 上传相关的
//上传文件进度条
@property(nonatomic,copy)LaomiCommonBlock progerss;

@property(nonatomic,strong)NSData *uploadData;//要上传的文件

@property(nonatomic,copy)NSString *uploadKey;//要上传的文件的key值

@property(nonatomic,copy)NSString *uploadFileName;//文件名

@property(nonatomic,copy)NSString *uploadFileType;//文件类型


+(LaomiRequestModel*)initWith:(NSString*)url param:(NSDictionary*)param;

@end

NS_ASSUME_NONNULL_END
